package com.ygqh.baby.mapper;

import com.ygqh.baby.ao.CouponType;
import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.ao.SalesPlatform;
import com.ygqh.baby.model.YgCouponModel;
import com.ygqh.baby.po.YgCoupon;
import com.ygqh.baby.po.YgCouponExample;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface YgCouponMapper {
    int countByExample(YgCouponExample example);

    int deleteByExample(YgCouponExample example);

    int deleteByPrimaryKey(Long id);

    int insert(YgCoupon record);

    int insertSelective(YgCoupon record);

    List<YgCoupon> selectByExample(YgCouponExample example);

    YgCoupon selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") YgCoupon record, @Param("example") YgCouponExample example);

    int updateByExample(@Param("record") YgCoupon record, @Param("example") YgCouponExample example);

    int updateByPrimaryKeySelective(YgCoupon record);

    int updateByPrimaryKey(YgCoupon record);

    int countSuper(@Param("supplierId") Long supplierId, @Param("pStatus") String pStatus, @Param("startDate") Date startDate, @Param("endDate") Date endDate,
                   @Param("q") String q, @Param("couponType") CouponType couponType, @Param("batchIds") Long[] batchIds);

    List<YgCoupon> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("supplierId") Long supplierId, @Param("pStatus") String pStatus,
                               @Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("q") String q, @Param("couponType") CouponType couponType,
                               @Param("batchIds") Long[] batchIds);

    List<YgCouponModel> selectOwnCouponList(@Param("queryInfo") QueryInfo queryInfo, @Param("userId") Long userId, @Param("cStatus") String cStatus,
                                            @Param("currentDate") String currentDate, @Param("sceneType") String sceneType, @Param("salesPlatform") String salesPlatform);

    /**
     * 只查询 scene_type=ALL 的优惠券
     */
    List<YgCouponModel> selectCouponListForPay(@Param("userId") Long userId, @Param("productPrice") BigDecimal productPrice, @Param("cStatus") String cStatus,
                                               @Param("currentDate") String currentDate, @Param("onlySpecial") Boolean onlySpecial);

    /**
     * 只查询 scene_type=ALL 的优惠券
     */
    YgCouponModel selectCouponForPay(@Param("userId") Long userId, @Param("couponDetailId") Long couponDetailId,
                                     @Param("productPrice") BigDecimal productPrice, @Param("currentDate") String currentDate, @Param("onlySpecial") Boolean onlySpecial);

    YgCoupon selectByCouponCode(@Param("couponCode") String couponCode, @Param("userId") Long userId);

    List<YgCouponModel> selectCouponForProduct(@Param("userId") Long userId, @Param("couponDetailId") Long couponDetailId,
                                               @Param("currentDate") String currentDate, @Param("useStatus") String useStatus, @Param("salesPlatform") String salesPlatform);

    List<YgCoupon> findCouponListByProductId(@Param("showWeb") Boolean showWeb,
                                             @Param("salesPlatform") SalesPlatform salesPlatform, @Param("productId") Long productId,
                                             @Param("currentDate") String currentDate);

    YgCoupon selectByDetailId(@Param("couponDetailId") Long couponDetailId);

}
